/**
 * Created by plter on 2016/11/10.
 */


(function () {

    var dropArea = document.querySelector("#drop-area");

    dropArea.ondragenter = function (e) {
        e.preventDefault();
    };
    dropArea.ondragover = function (e) {
        e.preventDefault();
    };
    dropArea.ondrop = function (e) {
        e.preventDefault();
        var file = e.dataTransfer.files[0];

        var reader = new FileReader();
        reader.onload = function () {
            dropArea.innerHTML = "<img src='" + reader.result + "'>";
        };
        reader.readAsDataURL(file);
    };

})();